<template>
    <div>
        <div class="cbody">
        <div class="top">
          <div :class="dayChange == 0 ? 'hac' : ''" @click="setDays(0)">全部</div>
          <div :class="dayChange == 1 ? 'hac' : ''" @click="setDays(1)">今日</div>
          <div :class="dayChange == 2 ? 'hac' : ''" @click="setDays(2)">近7天</div>
          <div :class="dayChange == 3 ? 'hac' : ''" @click="setDays(3)">近30天</div>
        </div>
        <div class="info">
          <div class="head">
            <div>
              <div class="name">合伙人收入</div>
              <div class="count">¥ {{money.pt}}</div>
            </div>
            <div>
              <div class="name">合伙人数量</div>
              <div class="count">¥ {{money.hh}}</div>
            </div>
            <div>
              <div class="name">账户余额</div>
              <div class="count">¥ {{money.fw}}</div>
            </div>
            <div>
              <div class="name">已提现金额</div>
              <div class="count">¥ {{money.yj}}</div>
            </div>
          </div>
          <div class="screen">
            合伙人列表
          </div>
          <div class="sel">
            <span>名称：</span>
            <input type="text" placeholder="服务商名称/合伙人" v-model="params.keyWord">
            <span>当前状态：</span>
            <select name  v-model="params.states">
              <option value="">请选择</option>
              <option value="0">待审核 </option>
              <option value="1">审核通过未打款 </option>
              <option value="2">审核通过已打款 </option>
              <option value="3">审核失败</option>
            </select>
            <div class="sel-btn">查询</div>
          </div>
          <div class="parchange">
            <div class="aced">默认</div>
            <div>收入</div>
            <div>提现</div>
            <div>余额</div>
          </div>
          <div class="table">
            <div class="thead">
              <div class="username">合伙人名称</div>
              <div class="parsr">合伙人收入</div>
              <div class=" txmoney">已提现金额</div>
              <div class="accmoney">账户余额</div>
              <div class="ptmoney">平台佣金</div>
              <div class="ctrl">操作</div>
            </div>
            <div class="tbody" v-for="(item,index) in info.withDrawalList" :key="index">
              <div class="username firstchild">
                <span>魏小延</span>
              </div>
              <div class="parsr">
                <span>¥8655.00</span>
              </div>
              <div class="txmoney">¥200.00</div>
              <div class=" accmoney">¥8655.00</div>
              <div class="ptmoney">10%</div>
              <div class="ctrl">收入明细</div>
            </div>
          </div>
        </div>
      </div>
    </div>
</template>
<script>
import axios from 'axios'
import qs from 'qs' // 将请求转换成form 表单提交形式
export default {
    data() {
    return {
        params: {
            keyWord:'',
            states:0,
            limit:10,
            page:1,
            type:2
        },
        money: {
            pt:0,
            hh:0,
            fw:0,
            yj:0
        },
        info:{

        },
        dayChange:0
    };
  },
  methods: {
      /**
       *  设置天数
       */
      setDays: function (num) {
          let that = this
          that.dayChange = num
          switch (num) {
              case 0:
                that.money = {
                    pt:that.info.totalPrice,
                    hh:that.info.partnerTotalPrice,
                    fw:that.info.serviceTotalPrice,
                    yj:that.info.backstageTotalPrice
                }
                break;
                case 1:
                that.money = {
                    pt:that.info.totalTodayPrice,
                    hh:that.info.partnerTodayTotalPrice,
                    fw:that.info.serviceTodayTotalPrice,
                    yj:that.info.backstageTodayTotalPrice
                }
                break;
                case 2:
                that.money = {
                    pt:that.info.totalWeekPrice,
                    hh:that.info.partnerWeekTotalPrice,
                    fw:that.info.serviceWeekTotalPrice,
                    yj:that.info.backstageWeekTotalPrice
                }
                break;
                case 3:
                that.money = {
                    pt:that.info.totalMonPrice,
                    hh:that.info.partnerMonTotalPrice,
                    fw:that.info.serviceMonTotalPrice,
                    yj:that.info.backstageMonTotalPrice
                }
                break;
          }
          console.log(that.money)
      },
      /**
       *  查询财务列表
       */
      getFinList: function (num) {
        let that = this;
      axios({
          method: 'post',
          url:`/tWithdrawal/selectDrawal`,
            data:qs.stringify(that.params)
      }).then(res => {
            console.log(res)
          if (res.data.code == 0) {
            that.info = res.data.data
            that.setDays(that.dayChange)
          } else {
            this.$alert(res.data.msg); 
          }
        })
        
      },
    /*
     * 根据时间毫秒数 返回年月日
     */
    setDate: function(str) {
      let times = new Date(str);
      return `${times.getFullYear()}-${
        times.getMonth()+1 < 10 ? "0" + times.getMonth()+1 : times.getMonth()+1
      }-${times.getDate() < 10 ? "0" + times.getDate() : times.getDate()}`;
    },
    /**
     * 根据时间毫秒数 返回时分秒
     */
    setTime: function(str) {
      let times = new Date(str);
      return `${
        times.getHours() < 10 ? "0" + times.getHours() : times.getHours()
      }:${
        times.getMinutes() < 10 ? "0" + times.getMinutes() : times.getMinutes()
      }:${
        times.getSeconds() < 10 ? "0" + times.getSeconds() : times.getSeconds()
      }`;
    }
  },
  mounted () {
      this.getFinList()
  }
}
</script>
<style scoped>
.screen,.parchange {
  width: 1520px;
  height: 60px;
  background: #f6f6f6;
  line-height: 60px;
  font-family: PingFangSC-Medium;
  margin-top: 30px;
  margin-bottom: 26px;
  font-size:18px;
color:#000000;
font-weight: bold;
padding-left: 24px;
box-sizing: border-box;
}
.parchange {
    padding: 0;
}
.parchange > div {
    display: inline-block;
    width: 110px;
    height: 36px;
    text-align: center;
    border-right: 1px solid #ddd;
    line-height: 36px;
    margin-top: 12px;
}
.parchange > div:last-of-type {
    height: 60px;
    margin-top: 0;
    line-height: 60px;
}
.parchange .aced {
    color:#085dab;
}
.screen img {
  float: left;
  width: 27px;
  height: 27px;
  margin-left: 10px;
  margin-top: 16px;
  margin-right: 18px;
}
.sel {
  height: 40px;
  line-height: 40px;
  width: 1520px;
}
.sel > span {
  font-weight: bold;
  font-size: 18px;
  color: #000000;
  float: left;
}
.sel > span:last-of-type {
  margin-left: 106px;
}
.sel > input {
  background: #ffffff;
  border: 1px solid #979797;
  box-shadow: inset 0 1px 3px 0 rgba(0, 0, 0, 0.5);
  width: 317px;
  height: 38px;
  font-size: 18px;
  color: #888888;
  text-align: center;
  float: left;
  outline: none;
}
.sel > select {
  background: #ffffff;
  border: 1px solid #979797;
  box-shadow: inset 0 1px 3px 0 rgba(0, 0, 0, 0.5);
  width: 317px;
  height: 38px;
  font-size: 18px;
  color: #888888;
  text-align: center;
  float: left;
  outline: none;
  padding-left: 70px;
}
.sel-btn {
  background: #085dab;
  border: 1px solid #085dab;
  width: 140px;
  height: 38px;
  font-size: 18px;
  color: #ffffff;
  text-align: center;
  float: left;
  margin-left: 50px;
  cursor: pointer;
}

.cbody {
  float: left;
}
.info {
  width: 1504px;

  height: 140px;
  background: #f6f6f6;
  margin-left: 4px;
}
.top {
  margin-top: 7px;
  height: 40px;
  height: 40px;
  text-align: center;
  width: 440px;
  color: #1875f0;
  border: 2px solid #1875f0;
  border-radius: 4px;
  display: flex;
  margin-bottom: 38px;
  margin-left: 476px;
}
.top > div {
  flex: 1;
  height: 40px;
  line-height: 40px;
  font-size: 14px;
  border-left: 2px solid #1875f0;
  font-weight: bold;
  cursor: pointer;
}
.top :first-child {
  border: 0;
}
.top .hac {
  background: #1875f0;
  color: #fff;
}
.head {
  display: flex;
  width: 1520px;
}
.head > div {
  flex: 1;
  border-left: 1px solid #fff;
  height: 140px;
  background: #f6f6f6;
}
.head :first-child {
  border-left: 0px solid #fff;
}
.name {
  font-size: 18px;
  color: #000000;
  height: 24px;
  text-align: center;
  margin-top: 23px;
  margin-bottom: 27px;
  font-weight: bold;
}
.count {
  height: 50px;
  font-size: 36px;
  color: #085dab;
  text-align: center;
  line-height: 50px;
}
.tabs {
  margin-top: 38px;
  border: 1px solid #dddddd;
  width: 398px;
  height: 67px;
  display: flex;
  font-size: 20px;
}
.tabs > div {
  flex: 1;
  font-size: 20px;
  height: 67px;
  line-height: 67px;
  text-align: center;
  font-weight: bold;
}
.tabs:first-child {
  border-right: 1px solid #ddd;
}
.tabs .tabac {
  background: #e0eefe;
}
.thead {
  background: #e0eefe;
  border: 1px solid #dddddd;
  width: 1490px;
  height: 67px;
  line-height: 67px;
}
.thead > div {
  float: left;
  height: 67px;
  border-right: 1px solid #ddd;
  text-align: center;
  font-weight: bold;
  font-size: 20px;
}
.tbody {
  width: 1492px;
  display: inline-block;
  overflow: hidden;
  height: 160px;
  border: 1px solid #ddd;
  box-sizing: border-box;
  margin-top: -2px;
}
.tbody > div {
  height: 158px;
  line-height: 160px;
  float: left;
  border-right: 1px solid #ddd;
  text-align: center;
  font-size: 18px;
  color: #4a4a4a;
  font-weight: bold;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.tbody > div > span {
  height: 30px;
  line-height: 30px;
  padding: 0 20px;
}
.tbody > div > div {
  height: 30px;
  line-height: 30px;
  text-align: center;
  width: 240px;
}
.username {
  width: 200px;
}
.parsr {
  width: 256px;
}
.accmoney {
  width: 278px;
}
.txmoney {
  width: 260px;
  
}
.tbody .accmoney {
    color: #fe0000;
}
.ptmoney {
  width: 270px;
}
.ctrl {
  width: 220px;
}
</style>


